package com.rjkj.medicalwaste.bean

import com.rjkj.medicalwaste.R

enum class MedicalWasteType constructor(
    val num: Int,
    val typeName: String,
    val alias: String,
    val colorId: Int,
    val bgId: Int,
    val typeConfig: String
) {
    GRX(1, "感染性", "感", R.color.grx, R.drawable.bg_grx, "感染性"),
    SSX(2, "损伤性", "损", R.color.ssx, R.drawable.bg_ssx, "损伤性"),
    BLX(3, "病理性", "病", R.color.blx, R.drawable.bg_blx, "病理性"),
    YWX(4, "药物性", "药", R.color.ywx, R.drawable.bg_ywx, "药物性"),
    HXX(5, "化学性", "化", R.color.hxx, R.drawable.bg_hxx, "化学性"),
    TP(3, "胎盘", "胎", R.color.blx, R.drawable.bg_blx, "病理性"),
    LQH(2, "利器盒", "利", R.color.ssx, R.drawable.bg_ssx, "损伤性"),
    XG(1, "新冠", "新", R.color.grx, R.drawable.bg_grx, "感染性"),
    NUllType(8, "NULL", "无", 0, 0, "NULL");

    companion object {
        fun getTypeByTypeName(string: String): MedicalWasteType {
            values().forEach {
                if (it.typeName == string) {
                    return it
                }
            }
            return NUllType
        }

        fun getBoxTypeByTypeName(string: String): MedicalWasteType {
            values().forEach {
                when {
                    string == TP.typeName -> {
                        return BLX
                    }
                    string == LQH.typeName -> {
                        return SSX
                    }
                    string == XG.typeName -> {
                        return GRX
                    }
                    it.typeName == string -> {
                        return it
                    }
                }
            }
            return NUllType
        }
    }
}